package com.design.pattern.principle;

public class SingleResponsibiltty1 {
    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();
        //run方法违反了单一职责原则
        vehicle.run("摩托车");
        vehicle.run("飞机");
        vehicle.run("汽车");
    }
}

/**
 * 1. run方法违反了单一职责原则
 * 2. 解决方式就是根据交通工具的类型不同，分解成不同的类
 */
class Vehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在公路上运行");
    }
}